﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace Unity.Game.ElisAdvance.ElisScript
{
    //玩家elis引入事件
    public class ElisState_JumpAttack
    {

        public static void onFixedProc(ElisActiveObject activeObject, float horiztantlKey)
        {

        }

        public static void onProc(ElisActiveObject obj)
        {

            float aniTime = obj.getAniManager().getAniTime();
            if (aniTime > 0.5f)
            {
                obj.clearStateVector();
                obj.pushStateVector(2);
                obj.setState(State.STATE_JUMP);
                return;
            }

            if (obj.isLand())
            {
                obj.clearStateVector();
                obj.setState(State.STATE_STAND);
                return;
            }

            /*
            if (Com.checkObjectTime(activeObject, "GLOBAL_JumpLandTimeEvent", 0.1f) && !activeObject.isLand())
            {

                activeObject.setCurrentPos(
                    Com.getDistancePos(activeObject.getXPos(), activeObject.getDirection(), 0.1f),
                    activeObject.getYPos());

                activeObject.clearStateVector();
                activeObject.pushStateVector(2);
                activeObject.setState(State.STATE_JUMP);
                return;
            }
            */
        }

        public static void onSetState(ElisActiveObject obj)
        {

            float index = obj.getStateVector(0);

            if (index == 0)
            {
                obj.getVar("GLOBAL_horiztantlKey").clear_vector();
                obj.getAniManager().setAni("JumpAttack");
                obj.getAniManager().setAniSpeed(1.5f);
                obj.getAttackInfo().setEnable(true, "OBJECT");
                //obj.getGravityEvent().setEnable(false);
                //obj.setXVelocity(0.0f);
                //obj.setYVelocity(0.0f);
            }

        }

    }
}